home *** CD-ROM | disk | FTP | other *** search
- this.onEnterFrame = function()
- {
- var t = this;
- if(t.mainDisplay.genListBox == true)
- {
- t.mainDisplay.updateListBox();
- }
- if(t.fade == "in")
- {
- if(t.loopvolume < t.initLoopVolume)
- {
- t.loopvolume += 5;
- t.loop.setVolume(t.loopvolume);
- }
- else if(t.loopvolume > t.initLoopVolume)
- {
- t.loopvolume = t.initLoopVolume;
- t.loop.setVolume(t.loopvolume);
- }
- }
- else if(t.fade == "out")
- {
- if(t.loopvolume > 0)
- {
- t.loopvolume -= 5;
- t.loop.setVolume(t.loopvolume);
- }
- else if(t.loopvolume < 0)
- {
- t.loopvolume = 0;
- t.loop.setVolume(t.loopvolume);
- }
- }
- if(t.gamePlay == true)
- {
- if(t.pause == false)
- {
- t.timer = t.timer + 1;
- if(Key.isDown(t.dKey))
- {
- if(t.launcher.my < t.launcher.maxS)
- {
- t.launcher.my += t.launcher.acc;
- if(t.launcher.my > t.launcher.maxS)
- {
- t.launcher.my = t.launcher.maxS;
- }
- }
- }
- else if(Key.isDown(t.uKey))
- {
- if(t.launcher.my > - t.launcher.maxS)
- {
- t.launcher.my -= t.launcher.acc;
- if(t.launcher.my < - t.launcher.maxS)
- {
- t.launcher.my = - t.launcher.maxS;
- }
- }
- }
- else
- {
- t.launcher.my *= t.f;
- t.launcher.hoverAng += 5;
- t.launcher.my += Math.sin(t.launcher.hoverAng * t.rc) / 17;
- }
- t.launcher._y += t.launcher.my;
- if(t.launcher._y < t.launcher.hit._height / 2 - t.launcher.hitDy)
- {
- t.launcher._y = t.launcher.hit._height / 2 - t.launcher.hitDy;
- t.launcher.my *= -0.5;
- }
- else if(t.launcher._y > t.stageH - t.launcher.hit._height / 2 - t.launcher.hitDy)
- {
- t.launcher._y = t.stageH - t.launcher.hit._height / 2 - t.launcher.hitDy;
- t.launcher.my *= -0.5;
- }
- if(t.reloading == true)
- {
- ang = 0;
- }
- else
- {
- var dx = t._xmouse - t.launcher._x;
- var dy = t._ymouse - t.launcher._y;
- var ang = Math.atan2(dy,dx) / t.rc;
- if(ang < -70)
- {
- ang = -70;
- }
- else if(ang > 50)
- {
- ang = 50;
- }
- }
- t.curAng += (ang - t.curAng) / 8;
- t.launcher.cupid.body._rotation = t.curAng * 0.3;
- t.launcher.cupid.body.belt._rotation = (- t.curAng) * 0.3;
- if(t.curAng > 40)
- {
- var headAng = 40;
- }
- else
- {
- var headAng = t.curAng;
- }
- t.launcher.cupid.head._rotation = headAng;
- t.launcher.cupid.body.arms._rotation = t.curAng * 0.7;
- t.launcher.cupid.body.arms2._rotation = t.launcher.cupid.body.arms._rotation;
- if(t.curAng < 0)
- {
- var legAng = (- t.curAng) * 0.1;
- }
- else
- {
- var legAng = (- t.curAng) * 0.5;
- }
- t.launcher.cupid.legs._rotation = legAng;
- var i = t.curArrow.length - 1;
- while(i >= 0)
- {
- var n = t.curArrow[i];
- n._rotation = t.curAng + n.ang;
- var point = new Object();
- point.x = t.launcher.cupid.body.arms.tPoint._x;
- point.y = t.launcher.cupid.body.arms.tPoint._y;
- t.launcher.cupid.body.arms.localToGlobal(point);
- n._x = point.x;
- n._y = point.y;
- i--;
- }
- if(t.charge == true)
- {
- if(t.power < t.maxPower)
- {
- t.power += t.chargeS;
- if(t.power > t.maxPower)
- {
- t.power = t.maxPower;
- }
- }
- t.launcher.powerBar._rotation = t.curAng;
- t.launcher.powerBar.bar._xscale = 100 * t.power / t.maxPower;
- }
- if(t.gameType == "real")
- {
- if(t.htim > t.hdel / t.hmyc)
- {
- t.createHeart();
- }
- else
- {
- t.htim = t.htim + 1;
- }
- if(t.puTim > t.puDel / t.hmyc)
- {
- t.createPU(0);
- t.puTim = 0;
- }
- else
- {
- t.puTim = t.puTim + 1;
- }
- }
- if(t.hmyc != t.inithmyc)
- {
- t.launcher.hSpuTim = t.launcher.hSpuTim + 1;
- if(t.launcher.hSpuTim == t.puHaveMax)
- {
- t.puFunc1(false);
- }
- }
- if(t.grav != t.initGrav)
- {
- t.launcher.gpuTim = t.launcher.gpuTim + 1;
- if(t.launcher.gpuTim == t.puHaveMax)
- {
- t.puFunc2(false);
- }
- }
- if(t.chargeS != t.initChargeS)
- {
- t.launcher.cpuTim = t.launcher.cpuTim + 1;
- if(t.launcher.cpuTim == t.puHaveMax)
- {
- t.puFunc3(false);
- }
- }
- if(t.launcher.maxS != t.launcher.initMaxS)
- {
- t.launcher.mSpuTim = t.launcher.mSpuTim + 1;
- if(t.launcher.mSpuTim == t.puHaveMax)
- {
- t.puFunc4(false);
- }
- }
- if(t.heartSize != t.initHeartSize)
- {
- t.launcher.hSIpuTim = t.launcher.hSIpuTim + 1;
- if(t.launcher.hSIpuTim == t.puHaveMax)
- {
- t.puFunc5(false);
- }
- }
- if(t.numShots != 1)
- {
- t.launcher.tSpuTim = t.launcher.tSpuTim + 1;
- if(t.launcher.tSpuTim == t.puHaveMax)
- {
- t.puFunc7(false);
- }
- }
- t.moveA();
- t.moveH();
- t.moveFly();
- }
- }
- else if(t.gameOver._alpha < 100)
- {
- t.gameOver._alpha += 3;
- if(t.gameOver._alpha > 100)
- {
- t.gameOver._alpha = 100;
- }
- }
- };
- this.onMouseDown = function()
- {
- var t = this;
- if(t.gamePlay == true)
- {
- if(t.pause == false)
- {
- if(t.reloading == false)
- {
- t.charge = true;
- t.beginCharge = false;
- t.launcher.powerBar.gotoAndStop("show");
- }
- else
- {
- t.beginCharge = true;
- }
- }
- }
- };
- this.onMouseUp = function()
- {
- var t = this;
- if(t.gamePlay == true)
- {
- if(t.pause == false)
- {
- if(t.charge == true)
- {
- t.launchArrow(t.power);
- t.power = 0;
- t.charge = false;
- t.curArrow = new Array();
- t.launcher.powerBar.gotoAndStop("blank");
- t.reloading = true;
- t.launcher.cupid.body.arms.anim.gotoAndPlay("reload");
- }
- }
- }
- };
- this.launcher.onKeyDown = function()
- {
- var t = this;
- var p = t._parent;
- if(p.gamePlay == true)
- {
- if(p.gameType == "real")
- {
- if(Key.isDown(p.pKey))
- {
- if(p.pause == false)
- {
- p.pauseFunc(true);
- }
- else
- {
- p.pauseFunc(false);
- }
- }
- }
- }
- if(p.typing == false)
- {
- if(Key.isDown(p.mKey))
- {
- if(p.globalsoundcontrol == "play")
- {
- p.globalsoundcontrol = "stop";
- p.fade = "out";
- }
- else if(p.globalsoundcontrol == "stop")
- {
- p.globalsoundcontrol = "play";
- p.fade = "in";
- }
- if(p.selectPlayer == false)
- {
- p.updateMusic();
- }
- else
- {
- p.updateBeginMusic();
- }
- p.mainDisplay.setSoundText();
- }
- }
- if(p.typing == false)
- {
- if(Key.isDown(p.sKey))
- {
- if(p.soundPlay == "true")
- {
- p.soundPlay = "false";
- }
- else
- {
- p.soundPlay = "true";
- }
- if(p.selectPlayer == false)
- {
- p.updateSound();
- }
- else
- {
- p.updateBeginSounds();
- }
- p.mainDisplay.setSoundText();
- }
- }
- d = p.mainDisplay;
- if(d.selectkey == true)
- {
- d.selectkey = false;
- pressed = Key.getCode();
- p[d.whichkey] = pressed;
- d.setValues(pressed,d.whichkey);
- }
- if(d.userNameGuide.text != "")
- {
- if(Key.isDown(13))
- {
- d.userNameInst.text = d.userNameGuide.text;
- d.userNameGuide.text = "";
- d.accept = "";
- }
- }
- };
- this.launcher.onKeyUp = function()
- {
- var t = this;
- var p = t._parent;
- if(p.logIn == true)
- {
- if(p.typing == true)
- {
- if(p.typeName == true)
- {
- var len = d.userNameInst.text.length;
- if(len > 0)
- {
- var i = 0;
- while(i < p.backUpAccountsA.length)
- {
- var name = p.backUpAccountsA[i][0];
- var parName = name.substring(0,len);
- trace("length: " + len);
- trace("text within textbox: " + d.userNameInst.text);
- trace("partial name: " + parName);
- if(parName == d.userNameInst.text and len != name.length)
- {
- trace("Found Name: " + name);
- d.userNameGuide.text = name;
- d.accept = "Press ENTER to accept name";
- break;
- }
- d.userNameGuide.text = "";
- d.accept = "";
- i++;
- }
- }
- else
- {
- d.userNameGuide.text = "";
- d.accept = "";
- }
- }
- }
- }
- };
- Key.addListener(this.launcher);
-